package com.itheima.utils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

import java.util.ResourceBundle;

/**
 * @version V1.0
 * @author: ljx
 * @date: 2020/01/13 17:10
 * @description:
 */
@Component
public class JedisUtil {

    @Autowired
    private JedisPool pool;

    public void sadd(String key, String values) {
        Jedis jedis = null;
        try {
            jedis = pool.getResource();
            jedis.sadd(key, values);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (jedis != null) {
                jedis.close();
            }
        }
    }
}
